﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using BrewTarget.Constants;

namespace BrewTarget.Models
{
    public class Fermentable : BeerBase
    {
        public string Name { get; set; }
        public FermentableType Type { get; set; }
        public double AmountInKilograms { get; set; }
        public double YieldPercent { get; set; }
        public double Color_SRM { get; set; }
        public bool AddAfterBoil { get; set; }
        public string Origin { get; set; }
        public string Supplier { get; set; }
        public string Notes { get; set; }
        public double CoarseFineDiff { get; set; }
        public double MoisturePercent { get; set; }

        public double DiastaticPower_Lintner { get; set; }
        public double ProteinPercent { get; set; }
        public double MaxInBatchPercent { get; set; }

        public bool RecommendMash { get; set; }
        public double IBUGallonPerPound { get; set; }

        public bool IsMashed { get; set; }
        public bool IsExtract { get; set; }
        public bool IsSugar { get; set; }
            

        public double EquivalentSucroseInKilograms
        {
            get
            {

               double ret = AmountInKilograms * YieldPercent * (1 - (MoisturePercent / 100)) / 100;
   
               // If this is a steeped grain...
               if( Type == FermentableType.Grain && !IsMashed)
                  return 0.60 * ret; // Reduce the yield by 60%.
               else
                  return ret;
                    
            }
        }


    }
}
